package com.example.mapper;

import com.example.entity.Event;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface EventMapper {

    //赛事查询
    @Select("select * from event where eventsName = #{eventsName}")
    List<Event> selectEvent(@Param("eventsName") String eventsName);

    //赛事创建（预告）
    @Insert("insert into event(eventsName, venueId, equipmentId, refereeInfo, startTime, endTime) values(#{equipmentName}, #{equipmentState}, #{equipmentCharges}, #{refereeInfo}, #{startTime}, #{endTime})")
    void addEvent(Event event);

    //赛事创建（预告）
    @Insert("insert into event(eventsName, venueId, equipmentId, refereeInfo, startTime, endTime) values(#{equipmentName}, #{equipmentState}, #{equipmentCharges}, #{refereeInfo}, #{startTime}, #{endTime})")
    void add(Event event);

    //赛事取消
    @Delete("delete from event where eventId = #{eventId}")
    void deleteEvent(@Param("eventId") int eventId);

    //显示最新的市场赛事
    @Select("select * from event order by startTime desc limit 10")
    List<Event> selectEventNear();

}
